﻿<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>

<script type="text/javascript">
	var sparepart = {
		gridId : "sparepartInDetailGrid",
		saveUrl : "sparepart/sparepartInDetail/save"
	};
</script>

<script type="text/javascript" src="js/widget/sparepart.js"></script>
<form:form id="sparepartInForm" commandName="model" cssClass="validate"
	action="sparepart/sparepartIn/save">
	<form:hidden path="id" />
	<isperp:processProcesser processId="${model.processId }"></isperp:processProcesser>
	<table class=" form-table">
		<tr>
			<td class="td1">入库编号：</td>
			<td class="td2"><form:input path="code" disabled="true" /><span>
					(自动生成)</span></td>
			<td class="td1">入库日期：</td>
			<td class="td2"><form:input type="date" path="instockDate"
					cssClass="required" /></td>
		</tr>
		<tr>
			<td class="td1">供应商：</td>
			<td class="td2" colspan="3"><form:hidden path="providerId" /> <isperp:listSelector
					id="manufacturerProviderName" url="provider/provider/list"
					displayValue="${ppdName }"
					name="manufacturerProviderName" displayValueCssStyle="width:150px;"
					valueControlId="providerId">
					<isperp:column name="id" title="id" hidden="true"></isperp:column>
					<isperp:column name="code" title="编号" width="80">
					</isperp:column>
					<isperp:column name="name" title="名称" width="150">
					</isperp:column>
					<isperp:column name="linkman" title="联系人" width="80">
					</isperp:column>
					<isperp:column name="linktel" title="联系电话" width="80">
					</isperp:column>
					<isperp:column name="serviceTel" title="客服电话" width="80">
					</isperp:column>
				</isperp:listSelector></td>
		</tr>
		<tr>
			<td class="td1">描述：</td>
			<td class="td2" colspan="3"><form:textarea path="memo"
					cssClass="required" /> </textarea>
			</td>
		</tr>
		<tr>
			<td class="td1">填表人：</td>
			<td class="td2" colspan="3"><label>${creatorName }</label>
			</td>
		</tr>
		<tr>
			<td class="td1">附件：</td>
			<td class="td2" colspan="3"><isperp:uploader
					sourceId="${model.id }" id="sptFiles"></isperp:uploader></td>
		</tr>
	</table>
	<isperp:grid
		url="sparepart/sparepartIn/listSparepartCi?sparepartId=${model.id }"
		gridId="sparepartInCiDetailGrid" showPager="true"
		showSearchbar="false" cusDialogSize="big"
		editurl="sparepart/sparepartInDetail/save" rowNum="15"
		cusDeleteUrl="sparepart/sparepartRelation/deleteByCiIdAndSptId?sparepartId=${model.id }"
		cusEditUrl="sparepart/sparepart/edit?pcontrolid=sparepartInCiDetailGrid&ty=sparepartIn&sourceId=${model.id }"
		cusFormatterActions="true">
		<jsp:attribute name="toolbar">
		<isperp:toolbar id="iconToolbar">
		   <div style="float:left;" class="header">
					<h3>入库清单(备注：状态默认为已入库，责任人为当前操作者，单击编辑可修改其他资产信息)</h3>
				</div>
			<isperp:button text="录入备件" icon="icon-plus" onclick="addCi();"></isperp:button>
			<isperp:button text="批量导入" icon="icon-plus" onclick="impCi();"></isperp:button>
		</isperp:toolbar>
		</jsp:attribute>

		<jsp:body>
		<isperp:column name="id" title="id" hidden="true"></isperp:column> 
					<isperp:column name="code" title="编号" width="120">
					</isperp:column>
					<isperp:column name="devide_number" title="设备号/PN号" width="160">
					</isperp:column> 
					<isperp:column name="stock_in_date" title="入库日期" width="120" formatter="date">
					</isperp:column>
					<isperp:column name="use_staff_name" title="责任人" width="120">
					</isperp:column>
					<isperp:column name="support_staff_name" title="使用人" width="120">
					</isperp:column>
					<isperp:column name="manufacturer" title="厂商" width="120">
					</isperp:column> 
					<isperp:column name="project_name" title="项目" width="120">
					</isperp:column>
					<isperp:column name="status" title="状态" width="120">
					</isperp:column> 
	</jsp:body>
	</isperp:grid>


</form:form>
<script type="text/javascript">
	function impCi() {
		isperp.openDialog({
			id : "expCiDialog",
			windowSize : 'big',
			contentUrl : 'db/import/edit?categoryName=备件管理&ty=sparepartIn&relationId=${model.id}&pcontrolid=sparepartInCiDetailGrid',
			title : "导入"
		});

	}

	function addDetail() {
		isperp.openDialog({
			id : "addSinDetailDialog",
			windowSize : 'small',
			contentUrl : 'sparepart/sparepartInDetail/addDetailEdit?pcontrolid=sparepartInDetailGrid&id=${model.id }',
			title : "新增需求"
		});
	}
	function addCi() {
	    var providerId=$("#providerId").val();
		isperp.openDialog({
			id : "addCiDialog",
			contentUrl : 'sparepart/sparepart/edit?pcontrolid=sparepartInCiDetailGrid&ty=sparepartIn&sourceId=${model.id }&providerId='+providerId,
			title : "新增"
		});
	}
</script>


<isperp:sparepartSelector relationId="${model.id }"
	gridId="sparepartInDetailGrid" formId="sparepartInForm"
	id="sparepartSelector"
	detailSaveUrl="sparepart/sparepartInDetail/saveDetails"></isperp:sparepartSelector>

<div class="header">
	<h3>关联流程</h3>
</div>

<isperp:processRelation businessKey="${model.id }" readonly="false"
	processKey="sparepartInProcess" projectIdControl="projectId"
	showTotalControl="relationProcessCount"></isperp:processRelation>

<isperp:buttonList>
	<isperp:processButtons processKey="sparepartInProcess"
		processId="${model.processId }" businessKey="${model.id }"
		formId="sparepartInForm"></isperp:processButtons>
	<button
		onclick="isperp.openDialog({contentUrl:'ReportServer?reportlet=project/spt_in_pd.cpt&op=write&id=${model.id}'})">打印入库单</button>
</isperp:buttonList>

